﻿using System;

namespace JinYuan.ControlLib.UCHelper
{

    //
    // 摘要:
    //     属性排序 序号比较器
    public class PropertyOrderPair : IComparable
    {
        private float order;

        private string categoryName;

        //
        // 摘要:
        //     类别名称
        public string CategoryName => categoryName;

        //
        // 参数:
        //   categoryName:
        //     类别名称
        //
        //   order:
        //     序号
        public PropertyOrderPair(string categoryName, float order)
        {
            this.order = order;
            this.categoryName = categoryName;
        }

        public int CompareTo(object obj)
        {
            PropertyOrderPair propertyOrderPair = (PropertyOrderPair)obj;
            if (propertyOrderPair.order == order)
            {
                return string.Compare(categoryName, propertyOrderPair.categoryName);
            }

            if (propertyOrderPair.order > order)
            {
                return -1;
            }

            return 1;
        }
    }
}
